package com.videoaggre.zcl.ui.activity

import android.content.Context
import android.content.pm.PackageManager
import android.text.TextUtils
import android.view.View
import androidx.fragment.app.commit
import com.tencent.smtt.sdk.QbSdk
import com.videoaggre.zcl.R
import com.videoaggre.zcl.common.startKtxActivity
import com.videoaggre.zcl.ui.activity.agefans.AgefansMainActivity
import com.videoaggre.zcl.ui.activity.imomoe.ImomoeMainActivity
import com.videoaggre.zcl.ui.activity.qiman.QimanMainActivity
import com.videoaggre.zcl.ui.activity.wallpaper.WallpaperMainActivity
import com.videoaggre.zcl.ui.fragment.ParseHtmlFragment
import com.videoaggre.zcl.utils.Logger
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : BaseActivity(R.layout.activity_main) {
    override fun initView() {
//        launchUI({ SERVICE.dynamicUrl("https://www.baidu.com")})
//        wvWebview.loadUrl("https://www.agefans.tv/play/20190373?playid=2_1")
//        wvWebview.stopLoading()
        supportFragmentManager.commit { replace(R.id.frameLayout, ParseHtmlFragment.newInstance()) }
        bindViewClick(ivAgefans, tvImomoe, tvWallpaper, tvQiman, tvWebsocket)
        Logger.e("x5==>${QbSdk.canLoadX5(this)}")
    }

    override fun onClick(v: View?) {
        when (v) {
            ivAgefans -> startKtxActivity<AgefansMainActivity>()
            tvImomoe -> startKtxActivity<ImomoeMainActivity>()
            tvWallpaper -> startKtxActivity<WallpaperMainActivity>()
            tvQiman -> startKtxActivity<QimanMainActivity>()
            tvWebsocket -> startKtxActivity<WebSocketActivity>()
        }
    }

}